<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>主页面板</title>
    <link rel="stylesheet" th:href="@{/css/pintuer.css}">
    <link rel="stylesheet" th:href="@{/css/admin.css}">
    <!-- Bootstrap CSS -->
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <!-- bootstrap theme -->
    <link th:href="@{/css/bootstrap-theme.css}" rel="stylesheet">

    <script th:src="@{/js/jquery.js}"></script>
    <script th:src="@{/js/pintuer.js}"></script>
</head>
<body>
<div class="showing-result-count">
    <p>当前第 [[${equipment.current}]] 页 总计 [[${equipment.pages}]] 页 共 [[${equipment.total}]] 条记录</p>
</div>
<div class="panel admin-panel">
    <!--    <form th:action="@{/weightinglist/ratio}" id="listform" method="post">-->
    <!--        <div class="padding border-bottom">-->
    <!--            <ul class="search" style="padding-left: 10px;">-->
    <!--                <li><strong style="color: #2ac845">设备称重信息概览</strong></li>-->
    <!--            </ul>-->
    <!--        </div>-->
    <!--    </form>-->
    <form th:action="@{/weightinglist/ratio}" id="listform" method="post">
        <div class="padding border-bottom">
            <ul class="search" style="padding-left: 10px;">
                <li><a class="button border-main " th:href="@{/weightinglist/ratio}">展示所有设备称重信息</a></li>
                <li><a class="button border-main " th:href="@{/UserExcelDownloads}">设备称重数据下载</a></li>
                <!--                <li>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;</li>-->
                <li>
                    <strong>从</strong>
                    <input type="date" placeholder="请输入称重时间" name="weighttime1" class="input"
                           style="width: 160px;line-height: 17px;display: inline-block" />
                    <strong>到</strong>
                    <input type="date" placeholder="请输入称重时间" name="weighttime2" class="input"
                           style="width: 160px;line-height: 17px;display: inline-block" />
                    <strong>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;</strong>
                    <strong>按设备所在仓库搜索</strong>
                    <!-- <input type="text" placeholder="请输入设备ID" name="equlocation" class="input"
                            style="width: 220px;line-height: 17px;display: inline-block" />-->
                    <select th:name="equlocation" class="form-control" style="width: 200px;line-height: 100px; display: inline-block">
                        <option th:value="-1"></option>
                        <option th:value="1号仓库">1号仓库</option>
                        <option th:value="2号仓库">2号仓库</option>
                        <option th:value="3号仓库">3号仓库</option>
                        <option th:value="4号仓库">4号仓库</option>
                        <option th:value="5号仓库">5号仓库</option>
                    </select>
                    <button type="submit" class="button border-main icon-search" onclick="changeSearch()">搜索</button>
                </li>
            </ul>
        </div>
    </form>
    <table class="table table-hover text-center">
        <tr>
            <th>设备名</th>
            <th>设备称重总重量</th>
            <th>单位</th>
            <th>设备所在仓库</th>
            <th>设备管理员</th>
            <!--<th>总重量比例</th>-->
        </tr>

        <div class="col-lg-4 col-sm-6"  th:each="equipment:${equipment.records}">
            <tr>
                <td th:text="${equipment.equid}"></td>
                <td th:text="${equipment.totalweight}"></td>
                <td th:text="${equipment.equunit}"></td>
                <td th:text="${equipment.equlocation}"></td>
                <td th:text="${equipment.equadmin}"></td>
               <!-- <td>
                    <div class="progress">
                        <div class="progress-bar" role="progressbar" aria-valuenow="${equipment.weightratio}" aria-valuemin="0" aria-valuemax="1" style="width: 60%;" >

                        </div>
                    </div>
                </td>-->
            </tr>
        </div>

        <tr>
            <td colspan="8">
                <div class="pagelist">
                    <!--                     <span  aria-current="page" th:each="num:${#numbers.sequence(1,weighings.pages)}">-->
                    <!--                        <a th:href="@{/weightinglist(pn=${num})}" th:class="${num==weighings.current?'page-numbers current':'page-numbers'}" >[[${num}]]</a>-->
                    <!--                    </span>-->
                    <ul class="pagination pull-right no-margin">

                        <!-- 首页 -->
                        <li>
                            <a th:href="@{/weightinglist/ratio(equlocation=${equlocation},pn=0)}">首页</a>
                        </li>

                        <!-- 上一页 -->
                        <li th:if="${equipment.hasPrevious()}">
                            <a th:href="@{/weightinglist/ratio(equlocation=${equlocation},pn=${equipment.getCurrent()-1})}" th:text="上一页"></a>
                        </li>

                        <!-- 中间页 -->
                        <!--                        <li th:each="pageNum:${#numbers.sequence(0, weighings.getPages() - 1)}">-->
                        <!--                            <a th:href="@{/weightinglist(pn=${pageNum + 1})}" th:text="" th:if="${pageNum ne weighings.getCurrent()}"></a>-->
                        <!--                            <a th:href="'/weightinglist?pageNum=' + ${pageNum}" th:text="${pageNum + 1}" th:if="${pageNum eq weighings.pageable.getPageNumber()}" th:style="'font-weight:bold;background: #6faed9;'"></a>-->
                        <!--                        </li>-->

                        <!-- 下一页 -->
                        <li th:if="${equipment.hasNext()}">
                            <a th:href="@{/weightinglist/ratio(equlocation=${equlocation},pn=${equipment.getCurrent()+1})}" th:text="下一页"></a>
                        </li>

                        <!-- 尾页 -->
                        <li>
                            <a th:href="@{/weightinglist/ratio(equlocation=${equlocation},pn=${equipment.getPages() })} ">尾页</a>
                        </li>

                    </ul>

                </div>
            </td>
        </tr>

    </table>
</div>

<script>
    function changeSearch(){
        var myfrm = document.forms;
        var myloginform = myfrm[0];
        var t1 = myloginform.elements[0].value;
        var t2 =myloginform.elements[1].value;
        if (t1>t2) {
            alert ("结束时间不能小于开始时间");
        }
        else
            $("#listform").submit();
    }
</script>
</body>
</html>